<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0"
        name="viewport">
  <#include "/common/csslib.html">
  <title>生成pdf测试</title>
</head>
<body>
<div class="main-wrapper">
  <!-- start: MAIN CONTAINER -->
  <div class="main-container inner">
    <!-- start: PAGE -->
    <div class="main-content">
      <div class="container">
        <div class="row h-home-path">
          <div class="col-md-12">
            <ol class="breadcrumb">
              <li><i class="fa fa-home"></i>&nbsp;&nbsp;所在位置</li>
              <li>首页</li>
              <li class="active">pdf测试</li>
            </ol>
          </div>
        </div>
        <div class="row h-main-search">
          <form action="javascript:;" method="post">
            <div class="pull-right h-btn-group">
              <button class="btn btn-info" id="return-btn"
                      onclick="PdfManager.createPdf()">
                <i class="fa fa-mail-reply">&nbsp;&nbsp;</i>生成pdf
              </button>
              <button class="btn btn-info" id="save" onclick="PdfManager.viewPdf()"
                      type="button">
                <i class="fa fa-save">&nbsp;&nbsp;</i>预览pdf
              </button>
              <button class="btn btn-info" id="save" onclick="PdfManager.downloadPdf()"
                      type="button">
                <i class="fa fa-save">&nbsp;&nbsp;</i>下载pdf
              </button>
            </div>
          </form>
        </div>

        <div class="form-horizontal has-success h-form-warp">
          <div class="h-msg-title h-table-header">
            <strong>pdf测试</strong>
          </div>
        </div>
      </div>
      <iframe id='exportTableIframe' name='exportTableIframe' style="display:none"></iframe>
      <form action='/pdfFactory/downloadPDF' id='exportForm' method='post' name='exportForm' target="exportTableIframe">
      </form>
    </div>
    <!-- end: PAGE -->
  </div>
  <!-- end: MAIN CONTAINER -->


  <!-- 新增 begin -->

</div>
<#include "/common/jslib.html">
<script type="text/javascript">
    $(function () {
        PdfManager = {
            // 初始化
            init: function () {

            },
            createPdf: function () {
                var url = "/pdfFactory/createPdf";
                var data = {};
                Jmts.ajaxPost(url, data, function (result) {
                    if (result.success) {
                        Jmts.alert("pdf生成成功，路径：" + result.pdfPath);
                    } else {
                        Jmts.alert(msg);
                    }

                });
            },
            viewPdf: function () {
                var url = "/pdfFactory/viewPdf";
                Jmts.openDialog("pdfId", url, "预览pdf", 500, 800, 32);
            },
            downloadPdf: function () {
                $("#exportForm").submit();
            }
        }
        //执行初始化
        PdfManager.init();
    });
</script>
</body>
</html>
